package com.mycase.im.boot.entity.database;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.Data;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.Email;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Pattern;
import javax.validation.constraints.Size;
import java.util.Date;
import java.util.List;

/**
 * @Author ZhuHJay
 * @Date 2021/7/31 23:49
 */
@Data
@JsonInclude(JsonInclude.Include.NON_EMPTY)
public class ImUser {

    /** 用户id( UUID ) **/
    @TableId(value = "id",type = IdType.ASSIGN_UUID)
    private String id;

    /** 登录账号( 手机号 ) **/
    @NotBlank(message = "手机号不能为空")
    @Pattern(regexp = "^(13[0-9]|14[01456879]|15[0-35-9]|16[2567]|17[0-8]|18[0-9]|19[0-35-9])\\d{8}$", message = "手机号格式错误")
    private String account;

    /** 登录密码 **/
    @NotBlank(message = "密码不能设置为空")
    @Pattern(regexp = "(?=.*([a-zA-Z].*))(?=.*[0-9].*)[a-zA-Z0-9-*/+.~!@#$%^&*()]{6,20}$", message = "至少包含数字跟字母,可以有字符,长度为6-20")
    private String password;

    /** 昵称 **/
    @NotBlank(message = "昵称设置不能为空")
    @Length(min = 1, max = 8, message = "昵称长度为1-8字")
    private String nikeName;

    /** 签名 **/
    @NotBlank(message = "个签不能设置为空")
    @Length(min = 1, max = 30, message = "个性签名长度为1-30字")
    private String sign;

    /** 头像 **/
    private String avatar;

    /** 邮箱 **/
    @Email(message = "邮箱格式不正确")
    private String email;

    /** 创建时间( 注册时间 ) **/
    private Date createTime;

    /** 用户状态( 暂无 ) **/
    private Integer status;

}
